<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@page import="Entity.*"%>
<%@page import="Dao.*"%>
<%@page import="java.util.Date" %>
<%@page import="java.text.SimpleDateFormat" %>
 <%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>查看学习资源</title>
</head>
<body>
<link href="css/learningResourceDetail.css" rel="stylesheet" type="text/css" />
<div class="header"><font size="6" color="#000000">资源详细信息</font></div>
<%
LearningResource lr=new LearningResourceDao().queryLearningResourceByResourceID(request.getParameter("resourceID").toString());
 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
String commentTime=df.format(new Date());  //获取当前系统时间 
String currentUserNo="";
if(session.getAttribute("session_userName")!=null){
	currentUserNo=session.getAttribute("session_userName").toString();
}
else if(session.getAttribute("session_admin")!=null){
	currentUserNo=session.getAttribute("session_admin").toString();
}
%>
<div class="body">
<table>
<tr><br></tr>
<tr>
<td><textarea rows="12" cols="150" readonly><%=lr.getBriefIntroduce() %></textarea></td>
</tr>
<tr>
<td><a href="/UniversityResourceSystem/SmartDownloadServlet?uploader=<%=lr.getUploaderID()%>&&fileName=<%=lr.getResourceName()%>&&myNo=<%=currentUserNo %>&&resourceID=<%=lr.getResourceID() %>" style="text-decoration: none">点击此处下载</a></td>
</tr>
</table>
</div>
<hr style="border: 1px solid black;"/>
<h3>评论</h3>
<form action="/UniversityResourceSystem/CommentServlet" method="post" name="comment_form">
<input type="hidden" value=<%=lr.getResourceID()+currentUserNo+new SequenceDao().getCommentIDBySequence() %> name="commentID"/>
<input type="hidden" value=<%=currentUserNo %> name="commentatorID"/>
<input type="hidden" value=<%=lr.getResourceID() %> name="resourceID"/>
<input type="hidden" value=<%=commentTime %> name="commentTime"/>
<textarea rows="3" cols="150" name="theContent"></textarea>&emsp;&emsp;<input type="submit" value="发表评论"/>
</form>
<hr style="border: 1px solid black;"/>
<div class="foot">
<table>
<%
List<Comment> clist=new CommentInformationDao().queryCommentByResourceID(lr.getResourceID());
for(Comment comment:clist){
%>
<tr>
<td>评论者ID：<input type="text" value=<%=comment.getCommentatorID() %> readonly/></td>
<td><textarea rows="2" cols="150" readonly><%=comment.getTheContent() %></textarea></td>
<td>评论时间：<input type="text" value=<%=comment.getCommentTime() %> readonly/></td>
<td><hr style="border: 1px solid grey;"/></td>
<%
}%>
</table>
</div>
</body>
</html>